﻿using System.Collections.Generic;
using InvoiceInvoker.Logic;
using InvoiceInvoker.MvcUI.Models;

namespace InvoiceInvoker.MvcUI.Helpers
{
	public static class ModelHelpers
	{
		public static List<ProductModel> ToProductModelList(this List<RegisteredProduct> registeredProducts)
		{
			List<ProductModel> result = new List<ProductModel>();

			registeredProducts.ForEach(product => result.Add(new ProductModel(product)));

			return result;
		}

		public static List<CustomerModel> ToCustomerModelList(this List<RegisteredCustomer> registeredCustomers)
		{
			List<CustomerModel> result = new List<CustomerModel>();

			registeredCustomers.ForEach(customer => result.Add(new CustomerModel(customer)));

			return result;
		}

		public static List<PatternModel> ToPatternModelList(this List<InvoicePattern> invoicePatterns)
		{
			List<PatternModel> result = new List<PatternModel>();

			invoicePatterns.ForEach(pattern => result.Add(new PatternModel(pattern)));

			return result;
		}

		public static List<InvoiceModel> ToInvoiceModelList(this List<Invoice> invoices)
		{
			List<InvoiceModel> result = new List<InvoiceModel>();

			invoices.ForEach(invoice => result.Add(new InvoiceModel(invoice)));

			return result;
		}
	}
}